import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
// import about from './views/About.vue'
// import Administrator from './views/authority/Administrator'
// import Basemanager from './views/authority/Basemanager'
// import logo from './components/logo'
// import Nav from './components/Nav'
// import articleHome from './views/Article/articleHome'
// import article from './views/Article/article'
// import editarticle from './views/Article/editarticle'
// import column from './views/Article/column'
// import Navigation from './views/navigation/Navigation'
// import Navigationone from './views/navigation/Navigationone'
// import Navigationthree from './views/navigation/Navigationthree'
// import Navigationtwo from './views/navigation/Navigationtwo'
// import Addbase from './views/base/Addbase'
Vue.use(Router)

export default new Router({
  mode: 'history',
  base: '/admin/',//process.env.BASE_URL,
  routes: [

      {
        path: '/login',
        name: 'login',
        component: () => import(/* webpackChunkName: "about" */ './components/login.vue'),
      },
      {
        path: '/',
        name: 'Nav',
        component: () => import(/* webpackChunkName: "about" */ './components/Nav.vue'),
        // 路由独享守卫
        beforeEnter:(to,from,next) =>{
          let token = sessionStorage.getItem('token')
          if(token){
            // 当token里有值时不改变路由指向
            next()
          } else {
            // 当没有token时路由指向logo
            // alert('还未登录,请先登录')
            next('./login')
          }
        },
        children:[
           {
            path: '/Home',
            // name: 'home',
            name: 'Home',
            component: Home
          },
          // PC
          {
            path: '/Signinsignoutone',
            name: 'Signinsignoutone',
            component: () => import('./views/BasemanagerPC/Signinsignoutone.vue')
          },
          {
            path: '/Administratoradd',
            name: 'Administratoradd',
            component: () => import('./views/Administratoradd/Administratoradd.vue')
          },
          {
            path: '/Administratoraddcompile',
            name: 'Administratoraddcompile',
            component: () => import('./views/Administratoradd/Administratoraddcompile')
          },
          {
            path: '/evaluate',
            name: 'evaluate',
            component: () => import('./views/BasemanagerPC/evaluate')
          },
          {
            path: '/practice',
            name: 'practice',
            component: () => import('./views/BasemanagerPC/practice')
          },
          {
            path: '/informationaggregation',
            name: 'informationaggregation',
            component: () => import('./views/BasemanagerPC/informationaggregation')
          },
          {
            path: '/informationaggregationone',
            name: 'informationaggregationone',
            component: () => import('./views/BasemanagerPC/informationaggregationone')
          },
          {
            path: '/twodimensioncode',
            name: 'twodimensioncode',
            component: () => import('./views/BasemanagerPC/twodimensioncode')
          },
          {
            path: '/Bookingmanagement',
            name: 'Bookingmanagement',
            component: () => import('./views/BasemanagerPC/Bookingmanagement')
          },
          // 修改密码
          {
            path: '/Changepassword',
            name:'Changepassword',
            component: () => import('./components/Changepassword.vue')
          },
          {
            path: '/personalcenter',
            name:'personalcenter',
            component: () => import('./components/personalcenter.vue')
          },
          // {
          //   path: '/Administrator',
          //   name: 'Administrator',
          //   component: () => import( './views/authority/Administrator.vue')
          // },
          {
            path: '/Basemanager',
            name: 'Basemanager',
            component: () => import( './views/authority/Basemanager.vue')
          },
          {
            path: '/about',
            name: 'about',
            component: () => import( './views/About.vue')
          },
          //区域管理
          {
            path: '/Area',
            name: 'Area',
            component: () => import( './views/Areamanagement/Area.vue'),
          },
          {
            path: '/Slideshow',
            name: 'Slideshow',
            component: () => import( './views/slideshow/Slideshow.vue')
          },
          {
            path: '/Slideshowone',
            name: 'Slideshowone',
            component: () => import('./views/slideshow/Slideshowone.vue')
          },
          {
            path: '/leaveamessage',
            name: 'leaveamessage',
            component: () => import('./views/leaveamessage/leaveamessage.vue')
          },
          // {
          //   path: '/articleHome',
          //   name: 'articleHome',
          //   component: () => import( './views/Article/articleHome.vue'),
          //   children:[

          //   ],redirect:'/article'
          // },
          {
            path: '/article',
            name: 'article',
            component: () => import( './views/Article/article.vue'),
          },
          {
            path: '/column',
            name: '/column',
            component: () => import( './views/Article/column.vue'),
          },
          {
            path: '/editarticle',
            name: 'editarticle',
            component: () => import( './views/Article/editarticle.vue'),
          },
          {
            path: '/Addbase',
            name: 'Addbase',
            component: () => import( './views/base/Addbase.vue'),
          },
          {
            path: '/Basenav',
            name: 'Basenav',
            component: () => import( './views/base/Basenav.vue'),
            children:[
          {
            path: '/Addbasetwo',
            name: 'Addbasetwo',
            component: () => import( './views/base/Addbasetwo.vue' ),
          },
            {
             path: '/Addbaseone',
             name: 'Addbaseone',
             component: () => import( './views/base/Addbaseone.vue'),
            },
            ],redirect:'/Addbaseone'
          },
          {
            path: '/Addbaseslideshowredact',
            name: 'Addbaseslideshowredact',
            component: () => import('./views/base/Addbaseslideshowredact.vue')
          },
          {
            path: 'basetwodimensioncode',
            name: 'basetwodimensioncode',
            component: () => import('./views/base/basetwodimensioncode')
          },
          {
              path: '/Addbasethree',
              name: 'Addbasethree',
              component: () => import('./views/base/Addbasethree.vue')
          },
          {
              path: '/Addbasecompile',
              name: 'Addbasecompile',
              component: () => import('./views/base/Addbasecompile.vue')
          },
          {
            path: '/baseaccount',
            name: 'baseaccount',
            component: () => import('./views/base/baseaccount.vue')
          },
          {
            path: '/baseaccountadd',
            name: 'baseaccountadd',
            component: () => import('./views/base/baseaccountadd.vue')
          },
          {
            path: '/Addbaseslideshow',
            name: 'Addbaseslideshow',
            component: () => import('./views/base/Addbaseslideshow.vue')
          },
          {
            path: '/Addbaserim',
            name: 'Addbaserim',
            component: () => import('./views/base/Addbaserim.vue')
          },
          {
            path: '/Addbaserimone',
            name: 'Addbaserimone',
            component: () => import('./views/base/Addbaserimone.vue')
          },
          {
            path: '/Navigation',
            name: 'Navigation',
            component: () => import( './views/navigation/Navigation.vue'),
            children:[
              {
              path: '/Navigationone',
              name: 'Navigationone',
              component: () => import( './views/navigation/Navigationone.vue'),
              },
              {
                path: '/Navigationthree',
                name: 'Navigationthree',
                component: () => import( './views/navigation/Navigationthree.vue'),
                },
                {
                  path: '/Navigationtwo',
                  name: 'Navigationtwo',
                  component: () => import( './views/navigation/Navigationtwo.vue'),
                  }
            ],redirect:'/Navigationone'
          },

          //author : feizns
          //基地统计
          {
            path: '/statistics/base',
            name:'base',
            component: () => import('./views/Zfeizns/Statistics/Base/BaseStatistics'),
          },

          //学校统计
          {
            path: '/statistics/school',
            name:'school',
            component: () => import('./views/Zfeizns/Statistics/School/SchoolStatistics'),
          },

          //模块统计
          {
            path: '/statistics/module',
            name: 'module',
            component: () => import('./views/Zfeizns/Statistics/Module/ModuleStatistics'),
          },

          //日志统计
          {
            path: '/statistics/log',
            name: 'log',
            component: () => import('./views/Zfeizns/Statistics/Logging/LoggingStatistics'),
          },
        ]
    },
  ]
})
